package cn.avalon.basic.service.impl;

import cn.avalon.basic.service.BaiduAiAuditService;
import cn.avalon.basic.utils.BaiduAuditUtils;
import org.springframework.stereotype.Service;

/**
 * @description:
 * @author: Avalon
 * @date: 2022年09月05日 ： 9:37
 * @version: ver1.0
 * @email 709785494@qq.com
 */
@Service
public class BaiduAiAuditServiceImpl implements BaiduAiAuditService {

    @Override
    public Boolean textAudit(String text) {
        return BaiduAuditUtils.TextCensor(text);
    }

    @Override
    public Boolean imageAudit(String resources) {
        Boolean result = true;
        if(resources != null){
            String[] arr = resources.split(",");
            for (String s : arr) {
                //只要有一张图片审核失败  = 宠物审核失败
                if(!BaiduAuditUtils.ImgCensor("http://123.207.27.208" + s)){
                    result = false;
                    break;
                }

            }
        }
        return result;
    }
}
